import {Injectable} from "@angular/core";

export abstract class DataCacheStrategy{
    static AUTHORIZATION:string="authorization";
    static LOGIN_USER:string="login_user";
    static GOOD_CATEGORIES:string="good_categories";
    static GOOD_TAGS:string="good_tag";
    static CURRENCIES:string="currencies";

    public abstract store(key:string,data:any);
    public abstract retrieve(key:string):any;
    public abstract  clear(key:string):boolean;
}

@Injectable()
export class DefaultDataCacheStrategy extends DataCacheStrategy{
    //todo store逻辑应考虑使用辅助线程操作（考察webworker）
    public store(key: string, data: any) {
        //angular和nativeScript分别实现自己的缓存逻辑
    }

    public retrieve(key: string): any {
        //angular和nativeScript分别实现自己的取缓存逻辑
        return null;
    }

    public clear(key: string): boolean {
        return true;
    }
}
